//
//  ScrollView.swift
//  Box
//
//  Created by mn on 2025/4/3.
//

import UIKit
import MJRefresh

extension UIScrollView {
    func addMJHeader(_ refresh:@escaping (() -> Void)) {
        self.mj_header = MJRefreshNormalHeader(refreshingBlock: refresh)
    }
    func addMJFooter(_ refresh:@escaping (() -> Void)) {
        self.mj_footer = MJRefreshAutoFooter(refreshingBlock: refresh)
    }
    func endHeaderRefreshing(){
        self.mj_header?.endRefreshing()
    }
    func endFooterRefreshing(){
        self.mj_footer?.endRefreshing()
    }
    func endAllRefreshing(){
        endHeaderRefreshing()
        endFooterRefreshing()
    }
    func headerBeginRefreshing() {
        self.mj_header?.beginRefreshing()
    }
    func setFooter(hidden: Bool) {
        self.mj_footer?.isHidden = hidden
    }

}
